package com.memory.admin.user.controller;

import com.memory.modules.business.domain.user.IssueRecord;
import com.memory.modules.business.service.user.IssueRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @PackageName: com.memory.admin.user.controller
 * @ClassName: IssueController
 * @Description:
 * @author: zhuguangxun
 * @date 2021/3/10
 */
@Controller
@RequestMapping("/business/issue")
@RequiredArgsConstructor
public class IssueController {

    private final IssueRecordService issueRecordService;

    @GetMapping("list")
    public String list(Model model, IssueRecord issueRecord) {
        ExampleMatcher matcher = ExampleMatcher.matching();
        Example<IssueRecord> example = Example.of(issueRecord,matcher);
        final Page<IssueRecord> page = issueRecordService.findPage(example);
        model.addAttribute("list", page);
        return "/business/issue/list";
    }
}
